package tech.horgee.config;

import org.redisson.api.RedissonClient;
import org.redisson.codec.JsonJacksonCodec;
import org.redisson.spring.cache.RedissonSpringCacheManager;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableCaching
public class MyCacheConfig {

    @Bean
    public CacheManager cacheManager(RedissonClient redissonClient) {
        redissonClient.getConfig().setCodec(JsonJacksonCodec.INSTANCE);
        return new RedissonSpringCacheManager(redissonClient);
    }

}
